<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ include file="../common/header.jsp"%>
<style type="text/css">
    input[type=number]{
        width:250px;
        height:28px;
        border-width:1px;
        border-style:solid;
        border-left-color:#c5c5c5;
        border-top-color:#c5c5c5;
        border-right-color:#e0e0e0;
        border-bottom-color:#e0e0e0;
        *line-height:28px;
        outline:none;
        /* background:url(../img/skin_/inputbg.png);*/
        padding:0 10px;
    }
</style>
    <div id="saper-container">
        <div id="saper-hd"></div>
        <div id="saper-bd">
            <div class="subfiled clearfix">
                <h2>${titleName}</h2>
            </div>
            <div class="subfiled-content">
                <div class="tab-container" data-trigger="click">
                    <div class="tab">
                        <a href="javascript:void(0);" class="current">法人数据采集</a>
                        <a href="javascript:void(0);">地理空间采集</a>
                        <a href="javascript:void(0);">农地数据采集</a>
                        <a href="javascript:void(0);">建筑物上报</a>
                        <a href="javascript:void(0);">部件上报</a>
                    </div>
                    <div class="tab-content">
                        <div class="tab-content-item">
                            <form class="saper-form layui-form" id="legalperson" >
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>公司、团体</label>
                                    <div class="kv-item-content">
                                        <input name="legalperson_companyName" lay-verify="maxlength|required" id="legalperson_companyName" type="text" placeholder="请输入公司或者团体名称" />
                                    </div>
                                    <div class="kv-item-tip">公司、团体名称</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>姓名：</label>
                                    <div class="kv-item-content">
                                        <input name="legalperson_name" id="legalperson_name" lay-verify="maxlength|required" type="text" placeholder="请输入真实姓名" />
                                    </div>
                                    <div class="kv-item-tip">法定代表人</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>邮箱：</label>
                                    <div class="kv-item-content">
                                        <input name="legalperson_email" id="legalperson_email" lay-verify="email" type="text" placeholder="请输入法人邮箱" />
                                    </div>
                                    <div class="kv-item-tip">法人邮箱</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>联系电话：</label>
                                    <div class="kv-item-content">
                                        <input name="legalperson_telphone" lay-verify="phone" id="legalperson_telphone" type="text" placeholder="请输入法定代表人手机" />
                                    </div>
                                    <div class="kv-item-tip">法定代表人联系电话</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>证件号：</label>
                                    <div class="kv-item-content">
                                        <input name="legalperson_idCard" id="legalperson_idCard" lay-verify="identity" type="text" placeholder="请输入法定代表人证件号" />
                                    </div>
                                    <div class="kv-item-tip">法定代表人证件号</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo"></span>职务：</label>
                                    <div class="kv-item-content">
                                        <input name="legalperson_position" id="legalperson_position" lay-verify="maxlength" type="text" placeholder="请输入法定代表人职务" />
                                    </div>
                                    <div class="kv-item-tip">法定代表人职务</div>
                                </div>
                                <div class="buttons">
                                    <button href="javascript:;" class="sapar-btn sapar-btn-recom" lay-submit lay-filter="*" name="legalperson_button" id="legalperson_button">确定</button>
                                </div>
                            </form>
                        </div>


                        <div class="tab-content-item">
                            <form class="saper-form" id="geospatial">

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>所在省市：</label>
                                    <div class="kv-item-content">
                                        <input name="geospatial_province" id="geospatial_province" type="text" value="四川省宜宾市" readonly/>
                                    </div>
                                    <div class="kv-item-tip">默认</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在县：</label>
                                    <div class="kv-item-content">
                                        <input name="geospatial_county" id="geospatial_county" type="text" value="兴文县" readonly/>
                                    </div>
                                    <div class="kv-item-tip">默认</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在乡镇：</label>
                                    <div class="kv-item-content">
                                        <select name="geospatial_town" onchange="select_change(this)">
                                        </select>
                                    </div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在村：</label>
                                    <div class="kv-item-content">
                                        <select name="geospatial_village">

                                        </select>
                                    </div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>详细地址：</label>
                                    <div class="kv-item-content">
                                        <input name="geospatial_address" id="geospatial_address" required   type="text" placeholder="请输入详细地址"/>
                                    </div>
                                    <div class="kv-item-tip">详细地址</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>经度:</label>
                                    <div class="kv-item-content">
                                        <input name="geospatial_lng" required id="geospatial_lng" lay-verify="maxlength" type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">如：105.243087</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>纬度:</label>
                                    <div class="kv-item-content">
                                        <input name="geospatial_lat" required id="geospatial_lat" lay-verify="maxlength" type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">如：28.309364</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>姓名：</label>
                                    <div class="kv-item-content">
                                        <input name="geospatial_gathererName" required id="geospatial_gathererName" lay-verify="maxlength|required" type="text" placeholder="请输入真实姓名"/>
                                    </div>
                                    <div class="kv-item-tip">为了保证登记信息的质量</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>身份证号：</label>
                                    <div class="kv-item-content">
                                        <input name="geospatial_gathererIdCard" required id="geospatial_gathererIdCard" lay-verify="identity" type="text" placeholder="请输入身份证号"/>
                                    </div>
                                    <div class="kv-item-tip">确保真实有效</div>
                                </div>

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>反馈号码：</label>
                                    <div class="kv-item-content">
                                        <input name="geospatial_reCall" required id="geospatial_reCall" lay-verify="phone" type="text" placeholder="请输入反馈号码"/>
                                    </div>
                                    <div class="kv-item-tip">当上报处理后，便于我们回访</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo"></span>事件描述：</label>
                                    <div class="kv-item-content">
                                        <select name="geospatial_eventType">
                                            <option value="1">实地调查</option>
                                            <option value="2">测量</option>
                                            <option value="3">现有地图</option>
                                            <option value="4">航空影像</option>
                                            <option value="5">遥感影像图片</option>
                                            <option value="6">过去的资料获取</option>
                                            <option value="7">其他</option>
                                        </select>

                                        <textarea style="margin-top: 5px;height: 200px" rows="10" cols="10" placeholder="请输入事件描述"
                                                  maxlength="500" name="geospatial_eventDescribe" id="geospatial_eventDescribe"></textarea>
                                        <%--<p> 当前字符<span class="brand-danger">0</span>个，还能输入<span class="brand-danger">500</span>个字符</p>--%>
                                    </div>
                                    <div class="kv-item-tip">先选择一种上报类别，再进行事件详细叙述，最好不要超过500字</div>
                                </div>

                                <div class="buttons">
                                    <button href="javascript:;" class="sapar-btn sapar-btn-recom" lay-submit lay-filter="*" name="geospatial_button" id="geospatial_button">确定</button>
                                </div>
                            </form>
                        </div>


                        <div class="tab-content-item" >
                            <form class="saper-form " id="cropland">

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>所在省市：</label>
                                    <div class="kv-item-content">
                                        <input name="cropland_province" type="text" value="四川省宜宾市" readonly/>
                                    </div>
                                    <div class="kv-item-tip">默认</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在县：</label>
                                    <div class="kv-item-content">
                                        <input name="cropland_county" id="cropland_county" type="text" value="兴文县" readonly/>
                                    </div>
                                    <div class="kv-item-tip">默认</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在乡镇：</label>
                                    <div class="kv-item-content">
                                        <select name="cropland_town" id="cropland_town" onchange="select_change(this)">

                                        </select>
                                    </div>
                                </div>

                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在村：</label>
                                    <div class="kv-item-content">
                                        <select name="cropland_village" id="cropland_village">

                                        </select>
                                    </div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>详细地址：</label>
                                    <div class="kv-item-content">
                                        <input name="cropland_address" id="cropland_address" required type="text" placeholder="请输入详细地址"/>
                                    </div>
                                    <div class="kv-item-tip">详细地址</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>经度:</label>
                                    <div class="kv-item-content">
                                        <input name="cropland_lng" id="cropland_lng" required type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">如：105.243087</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>纬度:</label>
                                    <div class="kv-item-content">
                                        <input name="cropland_lat" required id="cropland_lat" type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">如：28.309364</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>土地类型：</label>
                                    <div class="kv-item-content">
                                        <select name="cropland_landType" id="cropland_landType">
                                            <option>耕地</option>
                                            <option>林地</option>
                                            <option>草地</option>
                                            <option>农田水利用地</option>
                                        </select>
                                    </div>
                                    <div class="kv-item-tip">为了保证登记信息的质量</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>面积：</label>
                                    <div class="kv-item-content">
                                        <input name="cropland_landArea" id="cropland_landArea" required lay-verify="number" type="text" placeholder="请输入农地面积"/>
                                    </div>
                                    <div class="kv-item-tip">平方米</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo"></span>土地现状：</label>
                                    <div class="kv-item-content">
                                        <input name="cropland_landPresentSituation" id="cropland_landPresentSituation" type="text" placeholder="请输入农地现状"/>
                                    </div>
                                    <div class="kv-item-tip"></div>
                                </div>

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>姓名：</label>
                                    <div class="kv-item-content">
                                        <input name="cropland_gathererName" required id="cropland_gathererName" lay-verify="maxlength|required" type="text" placeholder="请输入真实姓名"/>
                                    </div>
                                    <div class="kv-item-tip">为了保证登记信息的质量</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>身份证号：</label>
                                    <div class="kv-item-content">
                                        <input name="cropland_gathererIdCard" required id="cropland_gathererIdCard" lay-verify="identify" type="text" placeholder="请输入身份证号" pattern="/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/"/>
                                    </div>
                                    <div class="kv-item-tip">确保真实有效</div>
                                </div>

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>反馈号码：</label>
                                    <div class="kv-item-content">
                                        <input name="cropland_reCall" required id="cropland_reCall" type="text" placeholder="请输入反馈号码" pattern=" /^1[34578]\d{9}$/"/>
                                    </div>
                                    <div class="kv-item-tip">当上报处理后，便于我们回访</div>
                                </div>

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo"></span>事件描述：</label>
                                    <div class="kv-item-content">
                                        <select name="cropland_eventType" id="cropland_eventType">
                                            <option value="1">实地调查</option>
                                            <option value="2">测量</option>
                                            <option value="3">现有地图</option>
                                            <option value="4">航空影像</option>
                                            <option value="5">遥感影像图片</option>
                                            <option value="6">过去的资料获取</option>
                                            <option value="7">其他</option>
                                        </select>

                                        <textarea style="margin-top: 5px;height: 200px" rows="10" cols="10" placeholder="请输入事件描述"
                                                  maxlength="500" name="cropland_eventDescribe" id="cropland_eventDescribe"></textarea>
                                        <%--<p> 当前字符<span class="brand-danger">0</span>个，还能输入<span class="brand-danger">500</span>个字符</p>--%>
                                    </div>
                                    <div class="kv-item-tip">先选择一种上报类别，再进行事件详细叙述，最好不要超过500字</div>
                                </div>

                                <div class="buttons">
                                    <button href="javascript:;" class="sapar-btn sapar-btn-recom" lay-submit lay-filter="*" name="cropland_button" id="cropland_button">确定</button>
                                </div>
                            </form>
                        </div>



                        <div class="tab-content-item">
                            <form class="saper-form" id="build">

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>所在省市：</label>
                                    <div class="kv-item-content">
                                        <input name="build_province" id="build_province" type="text" value="四川省宜宾市" readonly/>
                                    </div>
                                    <div class="kv-item-tip">默认</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在县：</label>
                                    <div class="kv-item-content">
                                        <input name="build_county" id="build_county" type="text" value="兴文县" readonly/>
                                    </div>
                                    <div class="kv-item-tip">默认</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在乡镇：</label>
                                    <div class="kv-item-content">
                                        <select name="build_town" onchange="select_change(this)">

                                        </select>

                                    </div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在村：</label>
                                    <div class="kv-item-content">
                                        <select name="build_village">


                                        </select>
                                    </div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>详细地址：</label>
                                    <div class="kv-item-content">
                                        <input name="build_address" required id="build_address" type="text" placeholder="请输入详细地址"/>
                                    </div>
                                    <div class="kv-item-tip">详细地址</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>经度:</label>
                                    <div class="kv-item-content">
                                        <input name="build_lng" id="build_lng" required  type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">如：105.243087</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>纬度:</label>
                                    <div class="kv-item-content">
                                        <input name="build_lat" id="build_lat" required type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">如：28.309364</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>楼房名称：</label>
                                    <div class="kv-item-content">
                                        <input name="build_buildName" required id="build_buildName" type="text" placeholder="请输入楼房名称"/>
                                    </div>
                                    <div class="kv-item-tip">楼房名称</div>
                                </div>

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>楼房类型：</label>
                                    <div class="kv-item-content">
                                        <select name="build_buildType" id="build_buildType">
                                            <option>民房</option>
                                            <option>商用大楼</option>
                                        </select>
                                    </div>
                                    <div class="kv-item-tip">楼房类型</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>楼层数：</label>
                                    <div class="kv-item-content">
                                        <input name="build_floor" id="build_floor" type="text" required placeholder="请输入楼层数"/>
                                    </div>
                                    <div class="kv-item-tip">层</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo"></span>楼房描述：</label>
                                    <div class="kv-item-content">
                                        <input name="build_buildDescribe" id="build_buildDescribe" type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">楼房描述,20字以内</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>姓名：</label>
                                    <div class="kv-item-content">
                                        <input name="build_gathererName" id="build_gathererName" required type="text" placeholder="请输入真实姓名"/>
                                    </div>
                                    <div class="kv-item-tip">为了保证登记信息的质量</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>身份证号：</label>
                                    <div class="kv-item-content">
                                        <input name="build_gathererIdCard" id="build_gathererIdCard" required type="text" placeholder="请输入身份证号"/>
                                    </div>
                                    <div class="kv-item-tip">确保真实有效</div>
                                </div>

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>反馈号码：</label>
                                    <div class="kv-item-content">
                                        <input name="build_reCall" id="build_reCall" type="text" required placeholder="请输入反馈号码"/>
                                    </div>
                                    <div class="kv-item-tip">当上报处理后，便于我们回访</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo"></span>事件描述：</label>
                                    <div class="kv-item-content">
                                        <select name="build_eventType" id="build_eventType">
                                            <option value="1">实地调查</option>
                                            <option value="2">测量</option>
                                            <option value="3">现有地图</option>
                                            <option value="4">航空影像</option>
                                            <option value="5">遥感影像图片</option>
                                            <option value="6">过去的资料获取</option>
                                            <option value="7">其他</option>
                                        </select>

                                        <textarea style="margin-top: 5px;height: 200px" rows="10" cols="10" placeholder="请输入事件描述"
                                                  maxlength="500" name="build_eventDescribe" id="build_eventDescribe"></textarea>
                                        <%--<p> 当前字符<span class="brand-danger">0</span>个，还能输入<span class="brand-danger">500</span>个字符</p>--%>
                                    </div>
                                    <div class="kv-item-tip">先选择一种上报类别，再进行事件详细叙述，最好不要超过500字</div>
                                </div>

                                <div class="buttons">
                                    <button href="javascript:;" class="sapar-btn sapar-btn-recom" lay-submit lay-filter="*" name="build_button" id="build_button">确定</button>
                                </div>
                            </form>
                        </div>

                        <div class="tab-content-item">
                            <form class="saper-form" id="part">

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>所在省市：</label>
                                    <div class="kv-item-content">
                                        <input name="part_province" id="part_province" type="text" value="四川省宜宾市" readonly/>
                                    </div>
                                    <div class="kv-item-tip">默认</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在县：</label>
                                    <div class="kv-item-content">
                                        <input name="part_county" id="part_county" type="text" value="兴文县" readonly/>
                                    </div>
                                    <div class="kv-item-tip">默认</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在乡镇：</label>
                                    <div class="kv-item-content">
                                        <select name="part_town" id="part_town" onchange="select_change(this)">

                                        </select>
                                    </div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label>
                                        <span class="impInfo">*</span>所在村：</label>
                                    <div class="kv-item-content">
                                        <select name="part_village" id="part_village">

                                        </select>
                                    </div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>详细地址：</label>
                                    <div class="kv-item-content">
                                        <input name="part_address" required id="part_address" type="text" placeholder="请输入详细地址"/>
                                    </div>
                                    <div class="kv-item-tip">详细地址</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>经度:</label>
                                    <div class="kv-item-content">
                                        <input name="part_lng" required id="part_lng" type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">如：105.243087</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>纬度:</label>
                                    <div class="kv-item-content">
                                        <input name="part_lat" id="part_lat" required type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">如：28.309364</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo"></span>部件类别：</label>
                                    <div class="kv-item-content">
                                        <select name="part_typeBig" id="part_typeBig" onchange="select_change_type(this)">

                                        </select>
                                    </div>
                                    <div class="kv-item-tip">一级分类</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo"></span></label>
                                    <div class="kv-item-content">
                                        <select name="part_typeSmall" id="part_typeSmall">

                                        </select>
                                    </div>
                                    <div class="kv-item-tip">二级分类</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>部件名称：</label>
                                    <div class="kv-item-content">
                                        <input name="part_partName" id="part_partName" required type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">部件名称</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>部件状态：</label>
                                    <div class="kv-item-content">
                                        <select name="part_partStatus" id="part_partStatus">
                                            <option value="1">完整</option>
                                            <option value="0">损坏</option>
                                        </select>

                                    </div>
                                    <div class="kv-item-tip">为了保证登记信息的质量</div>
                                </div>

                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>主管单位：</label>
                                    <div class="kv-item-content">
                                        <input name="part_competentOrg" required id="part_competentOrg" type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">主管单位</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo">*</span>权属单位：</label>
                                    <div class="kv-item-content">
                                        <input name="part_powerUnit" id="part_powerUnit" required type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">权属单位</div>
                                </div>
                                <div class="kv-item clearfix">
                                    <label><span class="impInfo"></span>描述：</label>
                                    <div class="kv-item-content">
                                        <input name="part_partDescribe" id="part_partDescribe" type="text" placeholder=""/>
                                    </div>
                                    <div class="kv-item-tip">描述，20字以内</div>
                                </div>

                                <div class="buttons">
                                    <button href="javascript:;" class="sapar-btn sapar-btn-recom" lay-submit lay-filter="*" name="part_button" id="part_button">确定</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="saper-ft"></div>
    </div>

<%@ include file="../common/footer.jsp"%>
<script type="text/javascript">

    var layer = layui.layer;
    var form = layui.form;
    var pattern_idcard=/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/;
    var pattern_telphone =/^1[34578]\d{9}$/;
    var pattern_float_number = /^\d+\.\d{1,6}$/;
    var pattern_number = /\d{1,10}/;

    function renderForm(){
        layui.use('form', function(){
            var form = layui.form;
            form.render();
        });
    }
    // $(".buttons .sapar-btn").click(function(){
    //     var typeName = this.name.split("_")[0];
    //     var btnType = typeName+"_";
    //     var url = "/ajax/grid/save"+typeName;
    //     console.log(btnType+","+url);
    //     postDataToControll(btnType,url);
    // });

    form.on('submit(*)', function(data){
        var typeName = this.name.split("_")[0];
        var btnType = typeName+"_";
        var url = "/ajax/grid/save"+typeName;
        console.log(btnType+","+url);
        postDataToControll(btnType,url);
        return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    });

    form.verify({
        maxlength: function(value){
            if(value.length > 20){
                return '字符数不超过20个';
            }
        },
        address: function(value){
            if(value.length > 50){
                return '字符数不超过50个';
            }
        }

    });

    function postDataToControll(btnType,url) {
        var inputs = $('input[name^='+btnType+']'),param = {};
        for(var i=0,len=inputs.length;i<len;i++){
            var inp = inputs[i];
            var key = $(inp).attr("name").split("_")[1];
            if(key !== undefined){
                var re = $(inp).attr("required");
                var va = $(inp).val().trim();
                var text_len = va.length;
                //-- 非必填项
                if(re == undefined && text_len > 20){
                    layer.msg("字数不超过20个！");
                    $(inp).focus();
                    return false;
                }
                //-- 必填项
                if(re !== undefined && va === ""){
                    layer.msg("红*标记的内容必须要填写！");
                    $(inp).focus();
                    return false;
                }
                //--必填字段不超过20字符
                if(re !== undefined && text_len >20){
                    layer.msg("字数不多于20个！");
                    $(inp).focus();
                    return false;
                }
                //--电话
                if(re !== undefined &&key=== "reCall"&&text_len !=11 &&!va.match(pattern_telphone)){
                    layer.msg("请输入11位的手机号码！");
                    $(inp).focus();
                    return false;
                }
                //--证件
                if(re !== undefined &&key=== "gathererIdCard"&&text_len !=18&&!va.match(pattern_idcard)){
                    layer.msg("请输入正确的身份证号码！");
                    $(inp).focus();
                    return false;
                }
                //--地址
                if(re !== undefined &&key=== "address"&&text_len >50){
                    layer.msg("字数不多于50个！");
                    $(inp).focus();
                    return false;
                }
                //--面积
                if(re !== undefined &&key=== "landArea"&&text_len >10){
                    layer.msg("数字一共不超过10位！");
                    $(inp).focus();
                    return false;
                }else if(re !== undefined &&key=== "landArea"&&!va.match(pattern_number)){
                    layer.msg("请填写数字！");
                    $(inp).focus();
                    return false;
                }
                //--楼层数
                if(re !== undefined &&key=== "floor"&&!va.match(pattern_number)){
                    layer.msg("请填写数字！");
                    $(inp).focus();
                    return false;
                }
                //--经度
                if(re !== undefined &&key=== "lng"&&text_len >10){
                    layer.msg("数字和小数点一共不超过10位！");
                    $(inp).focus();
                    return false;
                }else if(re !== undefined &&key=== "lng"&&!va.match(pattern_float_number)){
                    layer.msg("数值不能为负数,保留6位以内的小数！");
                    $(inp).focus();
                    return false;
                }
                //--纬度
                if(re !== undefined &&key=== "lat"&&text_len >10){
                    layer.msg("数字和小数点一共不超过10位！");
                    $(inp).focus();
                    return false;
                }else if(re !== undefined &&key=== "lat"&&!va.match(pattern_float_number)){
                    layer.msg("数值不能为负数，保留6位以内的小数！");
                    $(inp).focus();
                    return false;
                }

                var vt = $(inp).attr("value-type");
                if(vt !== undefined && vt === "integer") va = parseInt(va);
                param[key] = va;
            }
        }
        var selects = $("select[name^="+btnType+"]");
        for(var i=0,len=selects.length;i<len;i++){
            var sel = selects[i];
            var key = $(sel).attr("name").split("_")[1];
            if(key !== undefined){
                var va = $(sel).val();
                var vt = $(sel).attr("value-type");
                if(vt !== undefined && vt === "integer") va = parseInt(va);
                param[key] = va;
            }
        }

        var textareas = $("textarea[name^="+btnType+"]");
        for(var i=0,len=textareas.length;i<len;i++){
            var area = textareas[i];
            var key = $(area).attr("name").split("_")[1];
            if(key !== undefined){
                var va = $(area).val();
                var vt = $(area).attr("value-type");
                if(vt !== undefined && vt === "integer") va = parseInt(va);
                param[key] = va;
            }
        }

        console.log(JSON.stringify(param));
        $.post(""+url,{param:JSON.stringify(param)},function(res){
            if(res.code === 1)
                layer.msg("增加成功！",{},function(){refresh()});
        });

    }

    $.post("/ajax/grid/getTown",{},function (res) {
        if(res.code === 1){
            var data = res.data, len = res.data.length;
            if (len === 0) {
                $("select[name$=town]").html("");
                $("select[name$=town]").next().html("没有可以选取的类别");
            } else {
                var str = '';
                for (var i = 0; i < len; i++) {
                    var d = data[i];
                    str += '<option value="' + d['townId'] + '">' + d['townName'] + '</option>\n'
                }
                $("select[name$=town]").html(str);
                $("select[name$=town]").next().html(data[0]['townName']);
            }
            $.post("/ajax/grid/getVillage", {
                townId: data[0].townId
            }, function (res) {
                if (res.code === 1) {
                    var data = res.data, len = res.data.length;
                    if (len === 0) {
                        $("select[name$=village]").html("");
                        $("select[name$=village]").next().html("没有可以选取的类别");
                    } else {
                        var str = '';
                        for (var i = 0; i < len; i++) {
                            var d = data[i];
                            str += '<option value="' + d['villageId'] + '">' + d['villageName'] + '</option>\n'
                        }
                        $("select[name$=village]").html(str);
                        $("select[name$=village]").next().html(data[0]['villageName']);
                    }
                } else
                    console.log("请求失败！");
            });
        }
        renderForm();
    });

    //改变村
    function select_change(obj) {
        var that = $(obj);
        var select = that[0];
        var select_name = $(select).attr("name");
        var select_type =select_name.split("_")[0]+"_";
        console.log(select_name+":"+select_type+":"+select_type+"town");
        if (select_name === select_type+"town")
            $.post("/ajax/grid/getVillage", {
                townId: $(select).val()
            }, function (res) {
                if (res.code === 1) {
                    var data = res.data, len = res.data.length;
                    if (len === 0) {
                        $("select[name="+select_type+"village]").html("");
                        $("select[name="+select_type+"village]").next().html("没有可以选取的类别");
                    } else {
                        var str = '';
                        for (var i = 0; i < len; i++) {
                            var d = data[i];
                            str += '<option value="' + d['villageId'] + '">' + d['villageName'] + '</option>\n'
                        }
                        $("select[name="+select_type+"village]").html(str);
                        $("select[name="+select_type+"village]").next().html(data[0]['villageName']);

                    }
                    renderForm();
                } else
                    console.log("请求失败！");
            });

    }


    $.post("/ajax/grid/getBigType",{},function (res) {
        if(res.code === 1){
            var data = res.data, len = res.data.length;
            if (len === 0) {
                $("select[name=part_typeBig]").html("");
                $("select[name=part_typeBig]").next().html("没有可以选取的类别");
            } else {
                var str = '';
                for (var i = 0; i < len; i++) {
                    var d = data[i];
                    str += '<option value="' + d['code'] + '">' + d['name'] + '</option>\n'
                }
                $("select[name=part_typeBig]").html(str);
                $("select[name=part_typeBig]").next().html(data[0]['name']);
            }
            $.post("/ajax/grid/getSmallType", {
                bigCode: data[0].code
            }, function (res) {
                if (res.code === 1) {
                    var data = res.data, len = res.data.length;
                    if (len === 0) {
                        $("select[name=part_typeSmall]").html("");
                        $("select[name=part_typeSmall]").next().html("没有可以选取的类别");
                    } else {
                        var str = '';
                        for (var i = 0; i < len; i++) {
                            var d = data[i];
                            str += '<option value="' + d['code'] + '">' + d['name'] + '</option>\n'
                        }
                        $("select[name=part_typeSmall]").html(str);
                        $("select[name=part_typeSmall]").next().html(data[0]['name']);
                    }
                } else
                    console.log("请求失败！");
            });
        }
        renderForm();
    });

    function select_change_type(obj) {
        var that = $(obj);
        var select = that[0];
        var select_name = $(select).attr("name");
        if (select_name === "part_typeBig")
            $.post("/ajax/grid/getSmallType", {
                bigCode: $(select).val()
            }, function (res) {
                if (res.code === 1) {
                    var data = res.data, len = res.data.length;
                    if (len === 0) {
                        $("select[name=part_typeSmall]").html("");
                        $("select[name=part_typeSmall]").next().html("没有可以选取的类别");
                    } else {
                        var str = '';
                        for (var i = 0; i < len; i++) {
                            var d = data[i];
                            str += '<option value="' + d['code'] + '">' + d['name'] + '</option>\n'
                        }
                        $("select[name=part_typeSmall]").html(str);
                        $("select[name=part_typeSmall]").next().html(data[0]['name']);
                    }
                } else
                    console.log("请求失败！");
            });

        renderForm();
    }


</script>
